{
LANG : PASCAL
PROB : clock
}

program CLOCK;
const
  fi = 'clock.in';
  fo = 'clock.out';
  numh : array[1..13] of string = (
  'one', 'two', 'three', 'four', 'five', 'six',
  'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'one');
  num1 : array[0..19] of string = (
  '', '-one', '-two', '-three', '-four', '-five', '-six', '-seven',
  '-eight', '-nine', ' ten', ' eleven', ' twelve', ' thirteen', ' fourteen',
  ' fifteen', ' sixteen', ' seventeen', ' eighteen', ' nineteen');
  num10 : array[2..5] of string = (' twenty', ' thirty', ' forty', ' fifty');
var
  hour, minute : integer;
  s, res : string;

procedure process;
var
  v : integer;
  s1 : string;
begin
  v := pos(':', s);
  s1 := copy(s, 1, v-1);
  val(s1, hour, v);
  v := pos(':', s);
  s1 := copy(s, v+1, 2);
  val(s1, minute, v);
  if minute = 0 then
    res := numh[hour] + ' o''clock'
  else
  if minute < 15 then
  begin
    res := numh[hour] + num1[minute];
    if pos('-', res) <> 0 then res[pos('-', res)] := ' ';
  end
  else
  if minute = 15 then
    res := 'quarter past ' + numh[hour]
  else
  if minute < 45 then
    res := numh[hour] + num10[minute div 10] + num1[minute mod 10]
  else
  if minute = 45 then
    res := 'quarter to ' + numh[hour+1]
  else
  begin
    minute := 60 - minute;
    res := num1[minute] + ' to ' + numh[hour+1];
  end;
  while res[1] = ' ' do delete(res, 1, 1);
  while res[1] = '-' do delete(res, 1, 1);
  res[1] := upcase(res[1]);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  readln(s);
  process;
  writeln(res);
  close(output);
  close(input);
end.